// 优惠券相关
import request,{Method} from '@/libs/api.js'

// 添加优惠券
export function addCoupon (params) {
    return request({
      url: '/coupon/coupon/addCoupon',
      method: Method.POST,
      data: params
    });
}

// 获取卖家端优惠券的分页数据
export function getSellerCouponPage (params) {
    return request({
      url: '/coupon/coupon/getSellerCouponPage',
      method: Method.POST,
      data: params
    });
}

// 卖家端获取优惠券列表
export function sellerGetCouponList (params) {
    return request({
      url: '/coupon/coupon/sellerGetCouponList',
      method: Method.POST,
      data: params
    });
}

//根据ID获取优惠券详情
export function getCouponDetail(id){
  return request({
      url : `/coupon/coupon/getCouponDetail/${id}`,
      method: Method.GET,
  })
}

// 编辑优惠券
export function editCoupon (params) {
    return request({
      url: '/coupon/coupon/editCoupon',
      method: Method.PUT,
      data: params
    });
}

// 关闭当前优惠券活动
export function closeCoupon (id) {
    return request({
      url: `/coupon/coupon/closeCoupon/${id}`,
      method: Method.PUT,
    });
}

// 开启优惠券活动
export function openCoupon (params) {
    return request({
      url: '/coupon/coupon/openCoupon',
      method: Method.PUT,
      data: params
    });
}

// 删除优惠券
export function deleteCoupon (id) {
  return request({
    url: `/coupon/coupon/deleteCoupon/${id}`,
    method: Method.DELETE,
  });
}